package com.example.mapper;

import com.example.entity.Goods;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface GoodsMapper {

    int insert(Goods goods);

    void updateById(Goods goods);

    void deleteById(Integer id);

    Goods selectById(Integer id);

    List<Goods> selectAll(Goods goods);

    @Select("select count(*) from `goods`")
    int countAllPictures();

    @Select("SELECT * FROM goods")
    List<Goods> selectAllRecommend();

    @Select("SELECT * FROM goods ORDER BY RAND() LIMIT #{randomOffset}, #{pageSize}")
    List<Goods> selectRandomPictures(int randomOffset, int pageSize);
}
